package com.moyuxi.sound_of_the_forest.ui.pages.musicClassify

import androidx.compose.runtime.Composable
import com.moyuxi.sound_of_the_forest.entity.LocalMusicBean
import com.moyuxi.sound_of_the_forest.ui.compose.AlbumOrArtistListCompose

@Composable
fun ArtistListFrameCompose(
    data: List<LocalMusicBean>,
    navToScanMusic: () -> Unit,
    navToAlbumOrArtis: (LocalMusicBean,List<LocalMusicBean>) -> Unit
) {
    val artistMap: MutableMap<String, MutableList<LocalMusicBean>> = mutableMapOf()
    data.forEach {
        if (artistMap.containsKey(it.singer)) {
            val songList = artistMap.getValue(it.singer)
            songList.add(songList.size, it)
        } else artistMap[it.singer] = mutableListOf(it)
    }
    AlbumOrArtistListCompose(navToScanMusic,  artistMap, navToAlbumOrArtis)
}